import React, { useEffect, useState } from 'react'
import { Card, Col, List, Row } from 'antd';
import axios from 'axios'
import { Navigate, NavLink, useNavigate } from 'react-router-dom';
function Index() {


  const [list, setList] = useState([])

  const getData = async () => {
    const app = await axios.get('/api/article/list')
    console.log(app);
    setList(app.data.rows)

  }

  // const naviagte = useNavigate()
  useEffect(() => {
    getData()
  }, [])
  // const dian = (id) => {
  //   naviagte(`/home/user${id}`,{state:{id}})
  // }


  return (
    <div>

      <Row gutter={16}>
        {
          list.map((v, i) => {
            return (
              <Col span={12} >
                <List to={`/home/user${v.id}`}>
                  <Card title={v.icontent} variant="borderless" key={i}>
                  <p>{v.viewCount}</p>
                  <p>{v.title}</p>
                  <p>{v.updatedAt}</p>
                  <p></p>
                </Card>
                </List>
                
              </Col>
            )
          })
        }


      </Row>
    </div>
  )
}

export default Index
